package com.seda.fdc.ejb.reports.pdfgenerator.lowagie.text;

import com.lowagie.text.Document;
import com.lowagie.text.Utilities;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfWriter; 

public class SimpleTextBox extends AbstractTextBox { 
	
	public SimpleTextBox( ){
		super(); 
	}
	

	public SimpleTextBox(float millimitersX, float millimitersY){  
		super( Utilities.millimetersToPoints(millimitersX), 
				Utilities.millimetersToPoints(millimitersY) );
	}
	
	
	  
	public void setAbsolutePosition(float millimitersX, float millimitersY, PdfWriter writer) throws IllegalStateException{  
		super.setAbsolutePosition(Utilities.millimetersToPoints(millimitersX), 
				Utilities.millimetersToPoints(millimitersY), writer);  
	}


	public void setAbsolutePosition(float millimitersX, float millimitersY, PdfContentByte pdfContentByte)throws IllegalStateException{    
		super.setAbsolutePosition(Utilities.millimetersToPoints(millimitersX), 
				Utilities.millimetersToPoints(millimitersY), pdfContentByte);  
	}


	public void setAbsolutePositionTop(double millimitersX, double millimitersY, PdfContentByte pdfContentByte, float pageHeightMillimiters)throws IllegalStateException{  
		this.setAbsolutePositionTop((float)millimitersX, (float)millimitersY, pdfContentByte, pageHeightMillimiters);
	}
	public void setAbsolutePositionTop(float millimitersX, float millimitersY, PdfContentByte pdfContentByte, float pageHeightMillimiters)throws IllegalStateException{   
		super.setAbsolutePosition(Utilities.millimetersToPoints(millimitersX), 
				 Utilities.millimetersToPoints( pageHeightMillimiters - millimitersY), pdfContentByte);  
	}
	
	public void setAbsolutePositionTop(float millimitersX, float millimitersY, PdfWriter writer, Document doc) throws IllegalStateException{  
		float heightPageInMillimiters =  Utilities.pointsToMillimeters(doc.getPageSize().getHeight() ); 
		setAbsolutePosition(millimitersX, heightPageInMillimiters - millimitersY, writer);  
	}

}
